<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
    <head>
        <th:block th:include="include :: header('样品详细')" />
    </head>
    <body>
        <div class="main-content">
    <form class="form-horizontal" th:object="${service}">
        <h4 class="form-header h4">基本信息</h4>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">Service Name：</label>
                    <div class="col-sm-8">
                        <p class="form-control-plaintext" th:text="*{serName}"></p>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">Service Type：</label>
                    <div class="col-sm-8">
                        <p class="form-control-plaintext" th:text="*{svtypeName}"></p>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">Template：</label>
                    <div class="col-sm-8">
                        <p class="form-control-plaintext" th:text="*{templateName}"></p>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">Instrument：</label>
                    <div class="col-sm-8">
                        <p class="form-control-plaintext" th:text="*{instrument.instName}"></p>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">expcode：</label>
                    <div class="col-sm-8">
                        <p class="form-control-plaintext" th:text="*{expcode}"></p>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">priority：</label>
                    <div class="col-sm-8">
                        <p class="form-control-plaintext" th:text="*{priority == '0' ? 'NO' : 'YES'}"></p>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">Start time：</label>
                    <div class="col-sm-8">
                        <p class="form-control-plaintext" th:text="*{startTime}"></p>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">End Time：</label>
                    <div class="col-sm-8">
                        <p class="form-control-plaintext" th:text="*{endTime}"></p>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="form-group">
                    <label class="col-xs-2 control-label">Verifier：</label>
                    <div class="col-xs-10">
                        <p class="form-control-plaintext" th:text="${verifier}"></p>
                    </div>
                </div>
            </div>
        </div>
        <h4 class="form-header h4">状态信息</h4>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">Status：</label>
                    <div class="col-sm-8">
                        <p class="form-control-plaintext" th:text="*{@dict.getLabel('sys_service_status', serStatus)}"></p>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">Process：</label>
                    <div class="col-sm-8">
                        <p class="form-control-plaintext" th:text="*{@dict.getLabel('auto_exp_status', process)}"></p>
                    </div>
                </div>
            </div>
        </div>
        <h4 class="form-header h4">服务结果</h4>
        <div class="row">
            <!-- 原始文件下载 -->
            <div class="col-sm-6">
                <div class="form-group row">
                    <label class="col-sm-4 col-form-label">原始文件：</label>
                    <div class="col-sm-8">
                        <a th:if="${service.nmrfileId != null && service.nmrfileId != ''}"
                           th:href="@{'/system/request2/download?id=' + ${service.nmrfileId}}" download>
                            <i class="fa fa-download"></i> Raw data
                        </a>

                        <span th:unless="${service.nmrfileId != null && service.nmrfileId != ''}"> - </span>
                    </div>
                </div>
            </div>

            <!-- PDF报告浏览 -->
            <div class="col-sm-6">
                <div class="form-group row">
                    <label class="col-sm-4 col-form-label">PDF报告：</label>
                    <div class="col-sm-8">
                        <!-- 有 reportId，显示 PDF 链接 -->
                        <a th:if="${reportId != null && reportId != ''}"
                           th:href="@{'/common/preview?id=' + ${reportId}}"
                           target="_blank"
                           style="text-decoration: underline;">
                            PDF report
                        </a>

                        <!-- 没有 reportId，显示短横线 -->
                        <span th:unless="${reportId != null && reportId != ''}"> - </span>
                    </div>
                </div>
            </div>
        </div>
        <h4 class="form-header h4">其他信息</h4>
    </form>
</div>
        <th:block th:include="include :: footer" />
        <script th:inline="javascript">
            var prefix = ctx + "system/request2";
            var downloadUrl = prefix + "/download";
            var previewUrl = ctx + "common/preview";
        </script>
    </body>
</html>

